#version 330 core
layout(location = 0) in vec2 position;
layout(location = 1) in vec4 color;

out vec4 vColor;

uniform vec2 viewportSize;
uniform vec2 center;
uniform float scale;

void main() {
    vec2 scaledPos = position * scale;
    vec2 screenPos = center + scaledPos;

    vec2 ndc = vec2(
        2.0 * screenPos.x / viewportSize.x - 1.0,
        2.0 * screenPos.y / viewportSize.y - 1.0
    );

    gl_Position = vec4(ndc, 0.0, 1.0);
    vColor = color;
}